<?php /*Added by suwondo */ ?>
<?php include ('../../connections/con_gl.php'); ?>
<?php
$q = strtolower($_GET["q"]);
if (!$q) return;

mysql_select_db($database_con_gl, $con_gl);

switch($_REQUEST['proc']){
	case 'noref' :
		$query = mysql_query("select a.no_ref, a.kendaraan, b.nama from gl_rtrans as a inner join gl_kontak as b on (a.kontak = b.id) where a.tgl <= NOW() AND a.jatuhtempo <= NOW() AND a.jenis='7' AND (a.no_ref like '%$q%' OR a.kendaraan like '%$q%' OR b.nama like '%$q%')") or die (mysql_error());
		while(list($noref, $kendaraan, $nama) = mysql_fetch_row($query)){
			echo "$noref - $kendaraan - $nama \n";
		}
		break;
	case 'kendaraan' :
		$query = mysql_query("SELECT a.nopolisi, b.tipekendaraan, a.tahun, a.tersedia, c.kendaraan from gl_masterkendaraan a, gl_tipekendaraan b, gl_rtrans c where c.kendaraan=a.nopolisi AND a.tipekendaraan = b.id AND a.tersedia='1' and c.no_ref = '$_REQUEST[noref]' and (a.nopolisi like '%$q%' OR b.tipekendaraan like '%$q%' OR a.tahun like '%$q%') order by b.tipekendaraan, a.nopolisi asc") or die (mysql_error());
		while(list($nopolisi, $tipekendaraan, $tahun, $tersedia, $kendaraan) = mysql_fetch_row($query)){
			echo "$nopolisi - $tipekendaraan ($tahun) \n";
		}
		break;
}
?>